﻿using AutoMapper;
using NUnit.Framework;

namespace 系统中间件.Service
{
   
    //产品服务
    public class ProductService
    {
        //注入映射服务
        private readonly IMapper mapper;

        public ProductService(IMapper _mapper)
        {
            mapper = _mapper;
        }
        [SetUp]
        public void SetUp()
        {
            ProductCreateBo b = new ProductCreateBo();
            Add(b);

        }

       
        public void Add(ProductCreateBo bo)
        {
            //通过Map将bo对象映射生成一个Product类对象，
            Product product = mapper.Map<Product>(bo);
        }
    }

    public class Product
    { 
        public int  Id { get; set; }
        public string CategoryName { get; set; }

        public int CreatedUserId { get; set; }

        public decimal Price {  get; set; }

        public string ProductName {  get; set; }
    }


    public class ProductCreateBo { 

        public string CategoryName { get; set; }

        public int CreatedUserId { get; set; }


        public decimal Price { get; set; }

        public string ProductName { get; set; }
    }
}
